package org.example.imageservice.Command;


import org.example.imageservice.service.BgimageService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

public class UploadFileCommand extends Command{

    private final BgimageService bgimageService;
    private final String param2;
    private final MultipartFile uploadfile;
    ResponseEntity response;

    public UploadFileCommand(BgimageService bgimageService, String param2, MultipartFile uploadfile) {
        this.bgimageService = bgimageService;
        this.param2 = param2;
        this.uploadfile = uploadfile;
    }

    public ResponseEntity getResponse() {
        return response;
    }

    @Override
    public void execute() throws IOException {

       response=bgimageService.uploadFile(uploadfile,param2);

    }
}
